package com.ylsk.check.service.impl;

import java.util.List;

import com.ylsk.check.domain.vo.ExpresswaySectionVO;
import com.ylsk.common.config.SnowIdConfig;
import com.ylsk.common.exception.ServiceException;
import com.ylsk.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ylsk.check.mapper.ExpresswaySectionMapper;
import com.ylsk.check.domain.ExpresswaySection;
import com.ylsk.check.service.IExpresswaySectionService;

/**
 * 高速路段管理Service业务层处理
 *
 * @author yangsy
 * @date 2023-12-06
 */
@Service
public class ExpresswaySectionServiceImpl implements IExpresswaySectionService
{
    @Autowired
    private ExpresswaySectionMapper expresswaySectionMapper;

    @Autowired
    private SnowIdConfig snowIdConfig;

    /**
     * 查询高速路段管理
     *
     * @param expresswaySectionId 高速路段管理主键
     * @return 高速路段管理
     */
    @Override
    public ExpresswaySectionVO selectExpresswaySectionByExpresswaySectionId(Long expresswaySectionId)
    {
        return expresswaySectionMapper.selectExpresswaySectionByExpresswaySectionId(expresswaySectionId);
    }

    /**
     * 查询高速路段管理列表
     *
     * @param expresswaySection 高速路段管理
     * @return 高速路段管理
     */
    @Override
    public List<ExpresswaySectionVO> selectExpresswaySectionList(ExpresswaySection expresswaySection)
    {
        return expresswaySectionMapper.selectExpresswaySectionList(expresswaySection);
    }

    /**
     * 新增高速路段管理
     *
     * @param expresswaySection 高速路段管理
     * @return 结果
     */
    @Override
    public int insertExpresswaySection(ExpresswaySection expresswaySection)
    {
        expresswaySection.setExpresswaySectionId(snowIdConfig.getSnowId());
        return expresswaySectionMapper.insert(expresswaySection);
    }

    /**
     * 修改高速路段管理
     *
     * @param expresswaySection 高速路段管理
     * @return 结果
     */
    @Override
    public int updateExpresswaySection(ExpresswaySection expresswaySection)
    {
        Long expresswaySectionId = expresswaySection.getExpresswaySectionId();
        if(null == expresswaySectionId){
            throw new ServiceException("expresswaySectionId 不能为空");
        }
        return expresswaySectionMapper.updateById(expresswaySection);
    }

    /**
     * 批量删除高速路段管理
     *
     * @param expresswaySectionIds 需要删除的高速路段管理主键
     * @return 结果
     */
    @Override
    public int deleteExpresswaySectionByExpresswaySectionIds(Long[] expresswaySectionIds)
    {
        return expresswaySectionMapper.deleteExpresswaySectionByExpresswaySectionIds(expresswaySectionIds);
    }

    /**
     * 删除高速路段管理信息
     *
     * @param expresswaySectionId 高速路段管理主键
     * @return 结果
     */
    @Override
    public int deleteExpresswaySectionByExpresswaySectionId(Long expresswaySectionId)
    {
        return expresswaySectionMapper.deleteExpresswaySectionByExpresswaySectionId(expresswaySectionId);
    }
}
